home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Carousel
/
CAROUSEL.cdr
/
mactosh
/
code
/
p_serlib.sit
/
Serial Library Source Code
/
serial.resetBuffer.dll.c
< prev
next >
Wrap
C/C++ Source or Header
|
1989-07-27
|
2KB
|
90 lines
/***********************************************************************/
/*
/* serial.resetBuffer.dll.c
/* by Atul Butte
/* Copyright ⌐ 1989 by Microsoft Corporation
/* All Rights Reserved
/*
/* version 1.0
/*
/*
/* This CALL/REGISTER removes the buffer and resets it to the default.
/*
/* Excel usage:
/*
/* = Register( "serial library", "serial.resetBuffer", "IHJ" )
/* = Call( ref, portNumber, buffer )
/*
/* where
/* portNumber = number of port (1 = modem, 2 = printer)
/* buffer = pointer to current buffer
/*
/***********************************************************************/
/***********************************************************************/
/*
/* D E F I N E S
/*
/***********************************************************************/
#define ROUTINE_NAME "serial.resetBuffer"
#define hNIL 0L
#define pNIL 0L
/***********************************************************************/
/*
/* I N C L U D E S
/*
/***********************************************************************/
#include "serial.h"
#include "error.h"
#include "get_port.h"
/***********************************************************************/
/*
/* main
/*
/***********************************************************************/
pascal short main( port, pch )
unsigned short port; /* serial port to use */
char *pch; /* pointer to current buffer */
{
register OSErr err; /* result code from Toolbox routines */
short refIn; /* reference number for input port */
short refOut; /* reference number for output port */
RememberA0();
SetUpA4();
err = get_port( port, &refIn, &refOut );
if( err != noErr ) {
display_error( "Illegal port number." );
RestoreA4( );
return( err );
}
if( pch == pNIL ) {
display_error( "Buffer was never allocated." );
} else {
DisposPtr( pch );
if( MemError( ) != noErr ) {
display_error( "Error in disposing buffer." );
}
}
err = SerSetBuf( refIn, 0, 0 );
if( err != noErr ) {
display_error( "Error in resetting buffer." );
RestoreA4( );
return( errSerialSetBuf );
}
RestoreA4( );
return( noErr );
}
#include "get_port.c"